package com.qianxx.component.activity.menu.slide_menu;

import android.os.Bundle;
import android.view.View;

import com.qianxx.component.R;
import com.qianxx.component.activity.base.BaseActivity;
import com.qianxx.component.tool.TitleBar;
import com.qianxx.viewlibrary.menu.slidemenu.SlideMenu;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SlideMenuActivity extends BaseActivity {
    @BindView(R.id.slide_menu)
    SlideMenu slideMenu;
    @BindView(R.id.title_bar)
    TitleBar title_bar;
    private boolean isOpen;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slide_menu);
        ButterKnife.bind(this);
        title_bar.setOnClickListener(onClickListener);
    }

    private TitleBar.OnClickListener onClickListener=new TitleBar.OnClickListener() {
        @Override
        public void onLeftClick(View v) {
            if(isOpen){
                slideMenu.closeMenu();
                isOpen=false;
            }else{
                slideMenu.openMenu();
                isOpen=true;
            }

        }

        @Override
        public void onCenterClick(View v) {

        }

        @Override
        public void onRightClick(View v) {

        }
    };

    @Override
    public boolean setEnableTitleBar() {
        return false;
    }
}
